/**
 * @mbggenerated
 * @author wujian
 */
package bearworker.zxl.dao.mapper;

import bearworker.zxl.entity.DeliveryPackageFee;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface DeliveryPackageFeeMapper {
    /* @mbggenerated */
    @Delete({
        "delete from delivery_package_fee",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    /* @mbggenerated */
    @Insert({
        "insert into delivery_package_fee (send_province, send_city, ",
        "send_district, receive_province, ",
        "receive_city, receive_district, ",
        "cost_price, retail_price, ",
        "create_time, upd_time, ",
        "create_user_id, update_user_id, ",
        "state, weight)",
        "values (#{sendProvince,jdbcType=VARCHAR}, #{sendCity,jdbcType=VARCHAR}, ",
        "#{sendDistrict,jdbcType=VARCHAR}, #{receiveProvince,jdbcType=VARCHAR}, ",
        "#{receiveCity,jdbcType=VARCHAR}, #{receiveDistrict,jdbcType=VARCHAR}, ",
        "#{costPrice,jdbcType=INTEGER}, #{retailPrice,jdbcType=INTEGER}, ",
        "#{createTime,jdbcType=TIMESTAMP}, #{updTime,jdbcType=TIMESTAMP}, ",
        "#{createUserId,jdbcType=INTEGER}, #{updateUserId,jdbcType=INTEGER}, ",
        "#{state,jdbcType=TINYINT}, #{weight,jdbcType=INTEGER})"
    })
    @Options(useGeneratedKeys=true,keyProperty="id")
    int insert(DeliveryPackageFee record);

    /* @mbggenerated */
    @InsertProvider(type=DeliveryPackageFeeSqlProvider.class, method="insertSelective")
    @Options(useGeneratedKeys=true,keyProperty="id")
    int insertSelective(DeliveryPackageFee record);

    /* @mbggenerated */
    @Select({
        "select",
        "id, send_province, send_city, send_district, receive_province, receive_city, ",
        "receive_district, cost_price, retail_price, create_time, upd_time, create_user_id, ",
        "update_user_id, state, weight",
        "from delivery_package_fee",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="send_province", property="sendProvince", jdbcType=JdbcType.VARCHAR),
        @Result(column="send_city", property="sendCity", jdbcType=JdbcType.VARCHAR),
        @Result(column="send_district", property="sendDistrict", jdbcType=JdbcType.VARCHAR),
        @Result(column="receive_province", property="receiveProvince", jdbcType=JdbcType.VARCHAR),
        @Result(column="receive_city", property="receiveCity", jdbcType=JdbcType.VARCHAR),
        @Result(column="receive_district", property="receiveDistrict", jdbcType=JdbcType.VARCHAR),
        @Result(column="cost_price", property="costPrice", jdbcType=JdbcType.INTEGER),
        @Result(column="retail_price", property="retailPrice", jdbcType=JdbcType.INTEGER),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="upd_time", property="updTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="create_user_id", property="createUserId", jdbcType=JdbcType.INTEGER),
        @Result(column="update_user_id", property="updateUserId", jdbcType=JdbcType.INTEGER),
        @Result(column="state", property="state", jdbcType=JdbcType.TINYINT),
        @Result(column="weight", property="weight", jdbcType=JdbcType.INTEGER)
    })
    DeliveryPackageFee selectByPrimaryKey(Integer id);

    @Select({
            "select",
            "id, send_province, send_city, send_district, receive_province, receive_city, ",
            "receive_district, cost_price, retail_price, create_time, upd_time, create_user_id, ",
            "update_user_id, state, weight",
            "from delivery_package_fee",
            "where send_province = #{0,jdbcType=VARCHAR} and receive_province = #{1,jdbcType=VARCHAR} and weight = #{2,jdbcType=INTEGER} limit 1"
    })
    @Results({
            @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
            @Result(column="send_province", property="sendProvince", jdbcType=JdbcType.VARCHAR),
            @Result(column="send_city", property="sendCity", jdbcType=JdbcType.VARCHAR),
            @Result(column="send_district", property="sendDistrict", jdbcType=JdbcType.VARCHAR),
            @Result(column="receive_province", property="receiveProvince", jdbcType=JdbcType.VARCHAR),
            @Result(column="receive_city", property="receiveCity", jdbcType=JdbcType.VARCHAR),
            @Result(column="receive_district", property="receiveDistrict", jdbcType=JdbcType.VARCHAR),
            @Result(column="cost_price", property="costPrice", jdbcType=JdbcType.INTEGER),
            @Result(column="retail_price", property="retailPrice", jdbcType=JdbcType.INTEGER),
            @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
            @Result(column="upd_time", property="updTime", jdbcType=JdbcType.TIMESTAMP),
            @Result(column="create_user_id", property="createUserId", jdbcType=JdbcType.INTEGER),
            @Result(column="update_user_id", property="updateUserId", jdbcType=JdbcType.INTEGER),
            @Result(column="state", property="state", jdbcType=JdbcType.TINYINT),
            @Result(column="weight", property="weight", jdbcType=JdbcType.INTEGER)
    })
    DeliveryPackageFee selectBySendProvinceAndWeight(String sendProvince,String receiveProvince,int weight);

    /* @mbggenerated */
    @UpdateProvider(type=DeliveryPackageFeeSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(DeliveryPackageFee record);

    /* @mbggenerated */
    @Update({
        "update delivery_package_fee",
        "set send_province = #{sendProvince,jdbcType=VARCHAR},",
          "send_city = #{sendCity,jdbcType=VARCHAR},",
          "send_district = #{sendDistrict,jdbcType=VARCHAR},",
          "receive_province = #{receiveProvince,jdbcType=VARCHAR},",
          "receive_city = #{receiveCity,jdbcType=VARCHAR},",
          "receive_district = #{receiveDistrict,jdbcType=VARCHAR},",
          "cost_price = #{costPrice,jdbcType=INTEGER},",
          "retail_price = #{retailPrice,jdbcType=INTEGER},",
          "create_time = #{createTime,jdbcType=TIMESTAMP},",
          "upd_time = #{updTime,jdbcType=TIMESTAMP},",
          "create_user_id = #{createUserId,jdbcType=INTEGER},",
          "update_user_id = #{updateUserId,jdbcType=INTEGER},",
          "state = #{state,jdbcType=TINYINT},",
          "weight = #{weight,jdbcType=INTEGER}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(DeliveryPackageFee record);
}